home *** CD-ROM | disk | FTP | other *** search
/ NeXT Education Software Sampler 1992 Fall / NeXT Education Software Sampler 1992 Fall.iso / Programming / Classes / XText / XTScroller.m < prev   
Encoding:
Text File  |  1992-04-24  |  1.5 KB  |  55 lines

  1. /*    This file is part of the XText package (version 0.8)
  2.     Mike Dixon, April 1992
  3.     
  4.     Copyright (c) 1992 Xerox Corporation.  All rights reserved.
  5.  
  6.     Use and copying of this software and preparation of derivative works based
  7.     upon this software are permitted.  This software is made available AS IS,
  8.     and Xerox Corporation makes no warranty about the software or its
  9.     performance.
  10. */
  11.  
  12. #import "XTScroller.h"
  13. #import "XText.h"
  14.  
  15. @implementation XTScroller
  16.  
  17. - initFrame:(const NXRect *)frameRect
  18. {
  19.     NXRect rect = {0.0, 0.0, 0.0, 0.0};
  20.     NXSize s = {1.0E38, 1.0E38};
  21.     id my_xtext;
  22.     
  23.     // this is mostly cribbed from the TextLab example
  24.     // it's hard to believe that it needs to be this complicated
  25.  
  26.     [super initFrame:frameRect];
  27.     [[self setVertScrollerRequired:YES] setHorizScrollerRequired:NO];
  28.     [self setBorderType:NX_BEZEL];
  29.     
  30.     [self getContentSize:&(rect.size)];
  31.     my_xtext = [[XText alloc] initFrame:&rect];
  32.     [my_xtext setOpaque:YES];
  33.     [my_xtext notifyAncestorWhenFrameChanged:YES];
  34.     [my_xtext setVertResizable:YES];
  35.     [my_xtext setHorizResizable:NO];
  36.     [my_xtext setMonoFont:NO];
  37.     [my_xtext setDelegate:self];
  38.     
  39.     [my_xtext setMinSize:&(rect.size)];
  40.     [my_xtext setMaxSize:&s];
  41.     [my_xtext setAutosizing:NX_HEIGHTSIZABLE | NX_WIDTHSIZABLE];
  42.     
  43.     [my_xtext setCharFilter:NXEditorFilter];
  44.  
  45.     [self setDocView:my_xtext];
  46.     [my_xtext setSel:0 :0];    
  47.     
  48.     [contentView setAutoresizeSubviews:YES];
  49.     [contentView setAutosizing:NX_HEIGHTSIZABLE | NX_WIDTHSIZABLE];
  50.  
  51.     return self;
  52. }
  53.  
  54. @end
  55.